let keyword = decodeURIComponent(location.search).slice(3);
$('.search_input_input').val(keyword);

// 获取搜索详情页数据
myAjax(`http://1.117.169.27:3300/cloudsearch?keywords=${keyword}`)
    .then(res => {
        renderSearch(res.result.songs)
    })

// 渲染搜索详情页
function renderSearch(data) {
    data.forEach((v, k) => {
        $('.songlist_list').append(`
            <li class="song_list_item">
                    <div class="song_list_num">${k + 1}</div>
                    <div class="song_list_name">
                        <div class="song_list_song_name">
                            <a href="javascript:;">${v.name}</a>
                            <a href="javascript:;" class="sprite icon_mv" title="MV"></a>
                            <span class="sprite icon_vip" title="VIP"></span>
                        </div>
                        <div class="song_list_item_menu">
                            <a href="javascript:;" class="icon_play">
                                <i></i>
                            </a>
                            <a href="javascript:;" class="icon_add">
                                <i></i>
                            </a>
                            <a href="javascript:;" class="icon_down">
                                <i></i>
                            </a>
                            <a href="javascript:;" class="icon_share">
                                <i></i>
                            </a>
                        </div>
                    </div>
                    <div class="song_list_singer"><a href="javascrip:;">${v.ar[0].name}</a></div>
                    <div class="song_list_album"><a href="javascrip:;">${v.al.name}</a></div>
                    <div class="song_list_time">${dayjs(v.dt).format('mm:ss')}</div>
                </li>
        `);
    })
}
